﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GIMS.MODEL;
using KPIS.GERP.GIMS.DAL;
using KPIS.GERP.GIMS.DALFactory;
using KPIS.DBM;

namespace KPIS.GERP.GIMS.BLL
{
    public class BidBLL
    {
        private static readonly BidDAL dal = DataAccess.CreateBid();

        public IList<BidInfo> GetBid(Nullable<int> YearTypeSeq, Nullable<int> Year, string RecordStatus)
        {
            return dal.GetBid(YearTypeSeq, Year, RecordStatus);
        }

        public BidInfo GetBid(int Seq)
        {
            return dal.GetBid(Seq);
        }

        public void Insert(BidInfo info, IList<PurchaseRequestCommitteeInfo> infoListCommittee, IList<DocumentInfo> infoListFile)
        {
            try
            {
                dal.Insert(info, infoListCommittee, infoListFile);
            }
            catch
            {
                throw;
            }
        }

        public void Update(BidInfo info)
        {
            try
            {
                dal.Update(info);
            }
            catch
            {
                throw;
            }
        }

        public void DeleteAll(IList<BidInfo> infoList)
        {
            try
            {
                dal.DeleteAll(infoList);
            }
            catch
            {
                throw;
            }
        }

        public string UpdateTotalAndAmountConfirm(BidInfo info, IList<PrePurchaseRequestItemInfo> infoListPprItem, IList<BidRouteInfo> infoListRoute)
        {
            return dal.UpdateTotalAndAmountConfirm(info, infoListPprItem, infoListRoute);
        }

        public void Confirm(BidInfo info, IList<BidRouteInfo> infoListRoute, IDBManager dbManagerTrans)
        {
            dal.Confirm(info, infoListRoute, dbManagerTrans);
        }
    }
}
